import { CoolController, BaseController } from '@cool-midway/core';
import { Body, Inject, Post, Get, Query } from '@midwayjs/core';
import { AnchorInfoEntity } from '../../entity/info';
import { AnchorInfoService } from '../../service/info';

/**
 * anchor模块-主播信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: AnchorInfoEntity,
  service: AnchorInfoService,
  pageQueryOp: {
    keyWordLikeFields: ['anchorName', 'name', 'anchor'],
    fieldEq: ['status', 'permission', 'category'],
  }
})
export class AdminAnchorInfoController extends BaseController {
  @Inject()
  anchorInfoService: AnchorInfoService;

  // @Post('/list', { summary: '获取主播列表数据' })
  // async getAnchorList() {
  //     return 'this.ok(await this.anchorInfoService.getAnchorList())';
  // }

  @Post('/updateMemberData', { summary: '更新会员等级' })
  async updateMemberData() {
    return this.ok(await this.anchorInfoService.updateMemberData());
  }

  @Get('/getAnchorTotal', { summary: '获取主播成交数据' })
  async getAnchorTotal(@Query() queryData: any) {
    return this.ok(await this.anchorInfoService.getAnchorTotal(queryData));
  }

}
